package com.sunwayworld.core.user.web.action;

import com.sunwayworld.common.struts2.BaseAction;
import com.sunwayworld.core.user.valueobject.UserInfo;

public class UserAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private UserInfo user = new UserInfo();

	@Override
	public String execute() {
		method = "execute";
		return SUCCESS;
	}

	/**
	 * Method create 新增 User
	 * 
	 * @return "create"
	 */
	public String create() {

		return toUpdate();
	}

	/**
	 * Method update 更新 User
	 * 
	 * @return "update"
	 */
	public String update() {

		return toUpdate();
	}

	/**
	 * Method delete 删除 User
	 * 
	 * @return "delete"
	 */
	public String delete() {
		return toList();
	}

	/**
	 * Method toList 查询 User 列表
	 * 
	 * @return "list"
	 */
	public String toList() {
		method = "toList";
		return "list";
	}

	/**
	 * Method toCreate 跳转到新增 User 页
	 * 
	 * @return "detail"
	 */
	public String toCreate() {
		method = "toCreate";
		return "detail";
	}

	/**
	 * Method toUpdate 跳转到更新 User 页
	 * 
	 * @return "detail"
	 */
	public String toUpdate() {
		method = "toUpdate";
		return "detail";
	}

	/**
	 * Method toDetail 跳转到查询 User 页
	 * 
	 * @return "detail"
	 */
	public String toDetail() {
		method = "toDetail";
		return "detail";
	}

	// ///////////////////////////////
	public UserInfo getUser() {
		return user;
	}

	public void setUser(UserInfo user) {
		this.user = user;
	}
}
